package gui;

import javax.swing.JPanel;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.RowSpec;
import com.jgoodies.forms.factories.FormFactory;
import javax.swing.JLabel;
import javax.swing.JButton;
import javax.swing.JEditorPane;
import javax.swing.JTextField;
import javax.swing.JScrollPane;

public class AppPanelChapter extends JPanel {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 3532086094480804100L;
	public static JButton btnChapterNrDown = new JButton("Down");
	public static JLabel lblActChapterNr = new JLabel("Chapter Nr");
	public static JButton btnChapterNrUp = new JButton("Up");
	public static JButton btnChapterCreate = new JButton("Create");
	public static JButton btnChapterDelete = new JButton("Delete");
	public static JButton btnChapterEdit = new JButton("Save");
	public static JTextField txtChapterName = new JTextField();
	public static JScrollPane scrollPane = new JScrollPane();
	public static JEditorPane editorChapterDesc = new JEditorPane();
	private final JLabel lblChapterNameAnd = new JLabel("Chapter Name");
	
	
	
	/**
	 * Create the panel.
	 */
	public AppPanelChapter() {
		txtChapterName.setText("the name of your chapter");
		txtChapterName.setColumns(10);
		setLayout(new FormLayout(new ColumnSpec[] {
				FormFactory.RELATED_GAP_COLSPEC,
				ColumnSpec.decode("75px"),
				FormFactory.RELATED_GAP_COLSPEC,
				ColumnSpec.decode("default:grow"),
				FormFactory.RELATED_GAP_COLSPEC,
				ColumnSpec.decode("default:grow"),
				FormFactory.RELATED_GAP_COLSPEC,
				FormFactory.DEFAULT_COLSPEC,},
			new RowSpec[] {
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				RowSpec.decode("default:grow"),
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,}));
		
		add(lblChapterNameAnd, "4, 2, 3, 1");
		add(btnChapterEdit, "2, 4");
		txtChapterName.setText("\"the name of your chapter\"");
		add(txtChapterName, "4, 4, 3, 1, fill, default");
		txtChapterName.setColumns(10);
		add(txtChapterName, "4, 4, 3, 1, fill, default");
		add(btnChapterDelete, "2, 6");
		
		add(scrollPane, "4, 6, 3, 5, fill, fill");
		
		scrollPane.setViewportView(editorChapterDesc);
		editorChapterDesc.setText("this is a new chapter.");
		
		add(btnChapterCreate, "2, 8");
		
		JPanel panelNr = new JPanel();
		add(panelNr, "2, 10, fill, fill");
		panelNr.setLayout(new FormLayout(new ColumnSpec[] {
				FormFactory.RELATED_GAP_COLSPEC,
				FormFactory.DEFAULT_COLSPEC,},
			new RowSpec[] {
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,}));
		
		panelNr.add(btnChapterNrUp, "2, 4");
		panelNr.add(lblActChapterNr, "2, 6, center, default");
		panelNr.add(btnChapterNrDown, "2, 8");
	}

}
